﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Common;
    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Entities.Modules;
    using DotNetNuke.Entities.Users;
    using DotNetNuke.Services.Exceptions;
    using DotNetNuke.Services.Localization;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Diagnostics;
    using System.Runtime.CompilerServices;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class CheckOut : BaseModule, IPortable
    {
        [AccessedThroughProperty("billaddress")]
        private Address _billaddress;
        [AccessedThroughProperty("cartlist1")]
        private CartList _cartlist1;
        [AccessedThroughProperty("cartlist2")]
        private CartList _cartlist2;
        [AccessedThroughProperty("cmdBack1")]
        private LinkButton _cmdBack1;
        [AccessedThroughProperty("cmdBack2")]
        private LinkButton _cmdBack2;
        [AccessedThroughProperty("cmdCancelOrder")]
        private LinkButton _cmdCancelOrder;
        [AccessedThroughProperty("cmdContShop")]
        private LinkButton _cmdContShop;
        [AccessedThroughProperty("cmdNext1")]
        private LinkButton _cmdNext1;
        [AccessedThroughProperty("cmdOrder")]
        private LinkButton _cmdOrder;
        [AccessedThroughProperty("cmdPromo")]
        private LinkButton _cmdPromo;
        [AccessedThroughProperty("cmdVAT")]
        private LinkButton _cmdVAT;
        [AccessedThroughProperty("chkDefaultAddress")]
        private CheckBox _chkDefaultAddress;
        [AccessedThroughProperty("chkDefaultEmail")]
        private CheckBox _chkDefaultEmail;
        [AccessedThroughProperty("chkSaveAddrCookie")]
        private CheckBox _chkSaveAddrCookie;
        [AccessedThroughProperty("ddlCountry")]
        private DropDownList _ddlCountry;
        [AccessedThroughProperty("divPromoCode")]
        private HtmlGenericControl _divPromoCode;
        [AccessedThroughProperty("divShipCountry")]
        private HtmlGenericControl _divShipCountry;
        [AccessedThroughProperty("divShipMethod")]
        private HtmlGenericControl _divShipMethod;
        [AccessedThroughProperty("divShipMethod2")]
        private HtmlGenericControl _divShipMethod2;
        [AccessedThroughProperty("divVATCode")]
        private HtmlGenericControl _divVATCode;
        [AccessedThroughProperty("divVATCode2")]
        private HtmlGenericControl _divVATCode2;
        [AccessedThroughProperty("dlGateway2")]
        private DataList _dlGateway2;
        [AccessedThroughProperty("imgBChq")]
        private ImageButton _imgBChq;
        [AccessedThroughProperty("lblBankCard")]
        private Label _lblBankCard;
        [AccessedThroughProperty("lblBillingAddressTitle")]
        private Label _lblBillingAddressTitle;
        [AccessedThroughProperty("lblCheque")]
        private Label _lblCheque;
        [AccessedThroughProperty("lblNone")]
        private Label _lblNone;
        [AccessedThroughProperty("lblShippingAddressTitle")]
        private Label _lblShippingAddressTitle;
        [AccessedThroughProperty("lblUseBillingAddress")]
        private Label _lblUseBillingAddress;
        [AccessedThroughProperty("lblUseShippingAddress")]
        private Label _lblUseShippingAddress;
        [AccessedThroughProperty("plDefaultAddress")]
        private Label _plDefaultAddress;
        [AccessedThroughProperty("plDefaultEmail")]
        private Label _plDefaultEmail;
        [AccessedThroughProperty("plEmail")]
        private Label _plEmail;
        [AccessedThroughProperty("plhGateway")]
        private PlaceHolder _plhGateway;
        [AccessedThroughProperty("plhGatewayMsg")]
        private PlaceHolder _plhGatewayMsg;
        [AccessedThroughProperty("plhNoteMsg")]
        private PlaceHolder _plhNoteMsg;
        [AccessedThroughProperty("plhPayRtn")]
        private PlaceHolder _plhPayRtn;
        [AccessedThroughProperty("plPromoCode")]
        private Label _plPromoCode;
        [AccessedThroughProperty("plSaveAddrCookie")]
        private Label _plSaveAddrCookie;
        [AccessedThroughProperty("plShipCountry1")]
        private Label _plShipCountry1;
        [AccessedThroughProperty("plShippingMethods")]
        private Label _plShippingMethods;
        [AccessedThroughProperty("plVATCode")]
        private Label _plVATCode;
        [AccessedThroughProperty("plVATCode2")]
        private Label _plVATCode2;
        [AccessedThroughProperty("pnlAddress")]
        private Panel _pnlAddress;
        [AccessedThroughProperty("pnlAddressDetails")]
        private Panel _pnlAddressDetails;
        [AccessedThroughProperty("pnlCart")]
        private Panel _pnlCart;
        [AccessedThroughProperty("pnlEmptyCart")]
        private Panel _pnlEmptyCart;
        [AccessedThroughProperty("pnlGateway1")]
        private Panel _pnlGateway1;
        [AccessedThroughProperty("pnlGateway2")]
        private Panel _pnlGateway2;
        [AccessedThroughProperty("pnlLogin")]
        private Panel _pnlLogin;
        [AccessedThroughProperty("pnlPayRtn")]
        private Panel _pnlPayRtn;
        [AccessedThroughProperty("pnlPromptPay")]
        private Panel _pnlPromptPay;
        [AccessedThroughProperty("pnlShipAddress")]
        private Panel _pnlShipAddress;
        [AccessedThroughProperty("phEmptyCart")]
        private PlaceHolder _phEmptyCart;
        [AccessedThroughProperty("phHeader")]
        private PlaceHolder _phHeader;
        [AccessedThroughProperty("phLogin")]
        private PlaceHolder _phLogin;
        [AccessedThroughProperty("radBilling")]
        private RadioButton _radBilling;
        [AccessedThroughProperty("radNone")]
        private RadioButton _radNone;
        [AccessedThroughProperty("radShipping")]
        private RadioButton _radShipping;
        [AccessedThroughProperty("rblShipMethod")]
        private RadioButtonList _rblShipMethod;
        [AccessedThroughProperty("rblShipMethod2")]
        private RadioButtonList _rblShipMethod2;
        [AccessedThroughProperty("revEmail")]
        private RegularExpressionValidator _revEmail;
        [AccessedThroughProperty("shipaddress")]
        private Address _shipaddress;
        [AccessedThroughProperty("Stg2Form")]
        private CustomForm _Stg2Form;
        [AccessedThroughProperty("Stg3Form")]
        private CustomForm _Stg3Form;
        [AccessedThroughProperty("txtEmail")]
        private TextBox _txtEmail;
        [AccessedThroughProperty("txtNoteMsg")]
        private TextBox _txtNoteMsg;
        [AccessedThroughProperty("txtPromoCode")]
        private TextBox _txtPromoCode;
        [AccessedThroughProperty("txtVATCode")]
        private TextBox _txtVATCode;
        [AccessedThroughProperty("txtVATCode2")]
        private TextBox _txtVATCode2;
        [AccessedThroughProperty("valEmail")]
        private RequiredFieldValidator _valEmail;
        private GatewayWrapper objGateway;
        private string Stage;

        public CheckOut()
        {
            base.Load += new EventHandler(this.Page_Load);
            base.Init += new EventHandler(this.Page_Init);
            this.Stage = "";
            this.objGateway = new GatewayWrapper();
        }

        [CompilerGenerated, DebuggerStepThrough]
        private void _Lambda__1(object a0, EventArgs a1)
        {
            this.cartlist1_RecalculateCart();
        }

        [DebuggerStepThrough, CompilerGenerated]
        private void _Lambda__2(object a0, EventArgs a1)
        {
            this.cartlist1_RecalculateCart();
        }

        private void AddBankGateway()
        {
            int orderID = CurrentCart.GetCurrentCart(this.PortalId).OrderID;
            string text = this.CheckForElaspedOrderTime(orderID);
            if (text == "")
            {
                text = this.objGateway.GetButtonHtml(this.PortalId, orderID, SharedFunctions.GetCurrentCulture());
            }
            this.plhGateway.Controls.Add(new LiteralControl(text));
        }

        private void AddChqGateway()
        {
            if (Conversions.ToBoolean(this.Settings["chkHideChq"]))
            {
                this.imgBChq.Visible = false;
                this.lblCheque.Visible = false;
            }
            else
            {
                this.imgBChq.Visible = true;
                string str = SharedFunctions.GetStoreSetting(this.PortalId, "encapsulated.image", SharedFunctions.GetCurrentCulture());
                string str2 = SharedFunctions.GetStoreSetting(this.PortalId, "encapsulated.text", SharedFunctions.GetCurrentCulture());
                if (str == "")
                {
                    this.imgBChq.ImageUrl = base.StoreInstallPath + "img/BANKCHEQUE.gif";
                }
                else
                {
                    this.imgBChq.ImageUrl = this.PortalSettings.HomeDirectory + str;
                }
                if (str2 == "")
                {
                    this.lblCheque.Text = DotNetNuke.Services.Localization.Localization.GetString("lblCheque.Text", this.LocalResourceFile);
                }
                else
                {
                    this.lblCheque.Text = str2;
                }
            }
        }

        private bool AllowNonUserOrder()
        {
            return Conversions.ToBoolean(this.Settings["chkNonUserOrder"]);
        }

        private void cartlist1_CartIsEmpty()
        {
            this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId));
        }

        private void cartlist1_RecalculateCart()
        {
            if (this.txtPromoCode.Visible | this.txtVATCode.Visible)
            {
                NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
                currentCart.PromoCode = this.txtPromoCode.Text;
                currentCart.VATNumber = this.txtVATCode.Text;
                CurrentCart.Save(currentCart);
                this.cartlist1.PopulateCartList();
            }
            this.populateShipMethod();
        }

        private void cartlist1_ValidateCart()
        {
            CurrentCart.ValidateCart(this.PortalId, this.UserInfo);
        }

        private void cmdBack1_Click(object sender, EventArgs e)
        {
            this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=1" }));
        }

        private void cmdBack2_Click(object sender, EventArgs e)
        {
            this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=2" }));
        }

        private void cmdCancelOrder_Click(object sender, EventArgs e)
        {
            CurrentCart.CancelOrder(this.PortalId);
            if (Versioned.IsNumeric(Conversions.ToString(this.Settings["lstTabs"])))
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(Conversions.ToInteger(this.Settings["lstTabs"])));
            }
            else
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
            }
        }

        private void cmdContShop_Click(object sender, EventArgs e)
        {
            if (Versioned.IsNumeric(Conversions.ToString(this.Settings["lstTabContShop"])))
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(Conversions.ToInteger(this.Settings["lstTabContShop"])));
            }
            else
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
            }
        }

        private void cmdNext1_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                if (this.chkSaveAddrCookie.Checked)
                {
                    this.saveAddrCookie();
                }
                else
                {
                    this.removeAddrCookie();
                }
                this.SaveOrder();
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=3" }));
            }
        }

        private void cmdOrder_Click(object sender, EventArgs e)
        {
            int defaultShipMethod;
            this.cartlist1.UpdateQty();
            NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
            currentCart.VATNumber = this.txtVATCode.Text;
            currentCart.PromoCode = this.txtPromoCode.Text;
            currentCart.CountryCode = this.ddlCountry.SelectedValue;
            if (this.rblShipMethod.SelectedIndex >= 0)
            {
                defaultShipMethod = Conversions.ToInteger(this.rblShipMethod.SelectedValue);
            }
            else
            {
                defaultShipMethod = SharedFunctions.GetDefaultShipMethod(this.PortalId);
            }
            currentCart.ShipMethodID = defaultShipMethod;
            CurrentCart.Save(currentCart);
            if (Conversions.ToBoolean(this.Settings["chkSmoothLogin"]) & (this.UserId == -1))
            {
                int tabID = Conversions.ToInteger(this.Settings["ddlSmoothLoginTab"]);
                string str = "?ReturnURL=/tabid/" + Conversions.ToString(this.TabId) + "/stg/2/Default.aspx";
                if (tabID == this.TabId)
                {
                    this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(tabID, "", new string[] { "ctl=login", "stg=2" }) + str);
                }
                else
                {
                    this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(tabID, "") + str);
                }
            }
            else
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=2" }));
            }
        }

        private void CompletedBankPayment()
        {
            int orderID = CurrentCart.GetCurrentCart(this.PortalId).OrderID;
            string s = "";
            s = this.objGateway.GetCompletedHtml(this.PortalId, this.UserId, this.Request, orderID);
            if (EventInterface.Instance() != null)
            {
                EventInterface.Instance().CompletedOrder(this.PortalId, 2, orderID);
            }
            if (CurrentCart.GetCurrentCart(this.PortalId).BankHtmlRedirect != "KEEPCART")
            {
                new CartController().DeleteCart(CurrentCart.GetCurrentCart(this.PortalId).CartID);
            }
            this.pnlPayRtn.Visible = true;
            this.plhPayRtn.Controls.Add(new LiteralControl(this.Server.HtmlDecode(s)));
        }

        private void CompletedChqPayment()
        {
            int orderID = CurrentCart.GetCurrentCart(this.PortalId).OrderID;
            if (EventInterface.Instance() != null)
            {
                EventInterface.Instance().CompletedOrder(this.PortalId, 1, orderID);
            }
            new CartController().DeleteCart(CurrentCart.GetCurrentCart(this.PortalId).CartID);
            this.DisplayCompletedMsg(orderID, "chqpayment.text");
        }

        private void ContinueToPurchase(DataListItem LItem)
        {
            string selectedValue = "";
            Control control = LItem.FindControl("rblGateway");
            if (control != null)
            {
                selectedValue = ((RadioButtonList) control).SelectedValue;
            }
            if (selectedValue != "")
            {
                int orderID = CurrentCart.GetCurrentCart(this.PortalId).OrderID;
                NB_Store_GatewayInfo info = (NB_Store_GatewayInfo) SharedFunctions.GetAvailableGatewaysTable(this.PortalId)[selectedValue];
                if (info.gatewaytype == "CHQ")
                {
                    this.PayedByChq();
                    this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=5", "chq=1" }));
                }
                else
                {
                    OrderController controller = new OrderController();
                    NB_Store_OrdersInfo order = controller.GetOrder(orderID);
                    if (order != null)
                    {
                        order.BankAuthCode = info.assembly;
                        NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
                        currentCart.BankHtmlRedirect = "";
                        CurrentCart.Save(currentCart);
                        controller.UpdateObjOrder(order);
                        this.GatewayRedirect();
                    }
                }
            }
            else
            {
                this.PayedByChq();
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=5", "chq=1" }));
            }
        }

        private string CheckForElaspedOrderTime(int OrderID)
        {
            OrderController controller = new OrderController();
            string str2 = "";
            NB_Store_OrdersInfo order = controller.GetOrder(OrderID);
            if (((order != null) && (DateTime.Compare(order.ElapsedDate, Null.NullDate) != 0)) && (DateTime.Compare(order.ElapsedDate, DateAndTime.Now) < 0))
            {
                str2 = SharedFunctions.GetStoreSettingText(this.PortalId, "elapsedorder.text", SharedFunctions.GetCurrentCulture(), false, true);
            }
            return str2;
        }

        private void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.ReDisplayCart();
        }

        private void DisplayCompletedMsg(int OrderID, string TemplateID)
        {
            SettingsController controller2 = new SettingsController();
            OrderController controller = new OrderController();
            string strSourceText = "";
            this.pnlPayRtn.Visible = true;
            NB_Store_SettingsTextInfo info = controller2.GetSettingsText(this.PortalId, TemplateID, SharedFunctions.GetCurrentCulture());
            if ((info != null) && (info.SettingText != ""))
            {
                strSourceText = info.SettingText;
                strSourceText = new TokenStoreReplace(controller.GetOrder(OrderID), SharedFunctions.GetCurrentCulture()).DoTokenReplace(strSourceText);
            }
            this.plhPayRtn.Controls.Add(new LiteralControl(this.Server.HtmlDecode(strSourceText)));
        }

        private void DisplayEmptyCart()
        {
            SettingsController controller = new SettingsController();
            string strSourceText = DotNetNuke.Services.Localization.Localization.GetString("EmptyCart", this.LocalResourceFile);
            this.pnlEmptyCart.Visible = true;
            NB_Store_SettingsTextInfo info = controller.GetSettingsText(this.PortalId, "emptycart.text", SharedFunctions.GetCurrentCulture());
            if ((info != null) && (info.SettingText != ""))
            {
                strSourceText = HttpUtility.HtmlDecode(info.SettingText);
                strSourceText = new TokenStoreReplace(this.PortalId, SharedFunctions.GetCurrentCulture()).DoTokenReplace(strSourceText);
            }
            this.phEmptyCart.Controls.Add(new LiteralControl(strSourceText));
        }

        private void DisplayExtraDetailMsg()
        {
            SharedFunctions.DisplayMsgText(Conversions.ToString(this.PortalId), this.plhNoteMsg, "extradetail.text", DotNetNuke.Services.Localization.Localization.GetString("ExtraDetail", this.LocalResourceFile));
        }

        private bool DisplayLogin()
        {
            if ((this.UserId >= 0) | Versioned.IsNumeric(this.Request.QueryString["logmsg"]))
            {
                return false;
            }
            if (this.AllowNonUserOrder() && Conversions.ToBoolean(this.Settings["chkDisableLoginMsg"]))
            {
                return false;
            }
            return true;
        }

        private void DisplayLoginMsg()
        {
            this.pnlLogin.Visible = true;
            SharedFunctions.DisplayMsgText(Conversions.ToString(this.PortalId), this.phLogin, "logintext.text", DotNetNuke.Services.Localization.Localization.GetString("LoginText", this.LocalResourceFile));
        }

        private void DisplayMinimumCart()
        {
            SettingsController controller = new SettingsController();
            string expression = DotNetNuke.Services.Localization.Localization.GetString("EmptyCart", this.LocalResourceFile);
            this.pnlEmptyCart.Visible = true;
            NB_Store_SettingsTextInfo info = controller.GetSettingsText(this.PortalId, "minimumcarttotal.text", SharedFunctions.GetCurrentCulture());
            if ((info != null) && (info.SettingText != ""))
            {
                expression = HttpUtility.HtmlDecode(info.SettingText);
            }
            NB_Store_SettingsInfo info2 = controller.GetSetting(this.PortalId, "minimumcarttotal.limit", SharedFunctions.GetCurrentCulture());
            if (info2 != null)
            {
                expression = Strings.Replace(expression, "[TAG:CARTMINIMUM]", info2.SettingValue, 1, -1, CompareMethod.Binary);
            }
            expression = Strings.Replace(expression, "[TAG:CARTTOTAL]", SharedFunctions.FormatToStoreCurrency(this.PortalId, Convert.ToDouble(CurrentCart.GetCartItemTotal(this.PortalId, false))), 1, -1, CompareMethod.Binary);
            this.phEmptyCart.Controls.Add(new LiteralControl(expression));
        }

        private void DisplaySpecialShippingMsg()
        {
            this.pnlPayRtn.Visible = true;
            this.cmdOrder.Visible = false;
            this.cartlist1.ShippingHidden = true;
            this.cartlist1.PopulateCartList();
            SharedFunctions.DisplayMsgText(Conversions.ToString(this.PortalId), this.plhPayRtn, "specialshipping.text", "Special Shipping Required");
        }

        private void dlGateway2_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (Operators.ConditionalCompareObjectEqual(NewLateBinding.LateGet(e.CommandSource, null, "CommandName", new object[0], null, null, null), "Purchase", false))
            {
                DataListItem lItem = e.Item;
                this.ContinueToPurchase(lItem);
            }
        }

        public string ExportModule(int ModuleID)
        {
            string str = string.Empty;
            return str;
        }

        private void GatewayRedirect()
        {
            this.SaveForm3XML(CurrentCart.GetCurrentCart(this.PortalId).OrderID);
            this.objGateway.SetBankRemotePost(this.PortalId, CurrentCart.GetCurrentCart(this.PortalId).OrderID, SharedFunctions.GetCurrentCulture(), this.Request);
            if (InternalUpdateInterface.Instance() != null)
            {
                InternalUpdateInterface.Instance().BankRemotePost(this.PortalId, CurrentCart.GetCurrentCart(this.PortalId), SharedFunctions.GetCurrentCulture(), this.Request);
            }
            this.Response.Redirect(this.EditUrl("RemotePost"));
        }

        private void HideCartOptions()
        {
            if (Conversions.ToBoolean(this.Settings["chkHideVAT"]))
            {
                this.txtVATCode.Visible = false;
                this.txtVATCode2.Visible = false;
                this.cmdVAT.Visible = false;
                this.plVATCode.Visible = false;
                this.plVATCode2.Visible = false;
                this.divVATCode.Visible = false;
            }
            if (Conversions.ToBoolean(this.Settings["chkHidePromo"]))
            {
                this.txtPromoCode.Visible = false;
                this.cmdPromo.Visible = false;
                this.plPromoCode.Visible = false;
                this.divPromoCode.Visible = false;
            }
            if (Conversions.ToBoolean(this.Settings["chkHideCountry"]))
            {
                this.ddlCountry.Visible = false;
                this.plShipCountry1.Visible = false;
                this.divShipCountry.Visible = false;
            }
            if (!Conversions.ToBoolean(this.Settings["chkShowShipMethod"]))
            {
                this.rblShipMethod.Visible = false;
                this.divShipMethod.Visible = false;
                this.divShipMethod2.Visible = false;
            }
            string str = Conversions.ToString(this.Settings["rblGatewayDisplay"]);
            if (str == "1")
            {
                this.pnlGateway1.Visible = true;
                this.pnlGateway2.Visible = false;
            }
            else if (str == "2")
            {
                this.pnlGateway1.Visible = false;
                this.pnlGateway2.Visible = true;
            }
            else if (str == "3")
            {
                this.pnlGateway1.Visible = true;
                this.pnlGateway2.Visible = true;
            }
            else
            {
                this.pnlGateway1.Visible = true;
                this.pnlGateway2.Visible = false;
            }
        }

        private void imgBChq_Click(object sender, ImageClickEventArgs e)
        {
            this.PayedByChq();
            this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=5", "chq=1" }));
        }

        public void ImportModule(int ModuleID, string Content, string Version, int UserID)
        {
        }

        private bool IsNonUserOrder()
        {
            if (this.UserId >= 0)
            {
                return false;
            }
            return true;
        }

        private void Page_Init(object sender, EventArgs e)
        {
            string s = SharedFunctions.GetStoreSettingText(this.PortalId, "gateway.template", SharedFunctions.GetCurrentCulture());
            bool lockStockOnCart = SharedFunctions.GetStoreSettingBoolean(this.PortalId, "lockstockoncart", SharedFunctions.GetCurrentCulture());
            int qtyLimit = 0xf423f;
            string expression = SharedFunctions.GetStoreSetting(this.PortalId, "productqty.limit", SharedFunctions.GetCurrentCulture());
            if (Versioned.IsNumeric(expression))
            {
                qtyLimit = Conversions.ToInteger(expression);
            }
            this.dlGateway2.ItemTemplate = new ProductTemplate(this.TabId, this.ModuleId, base.StoreInstallPath, "50", this.Server.HtmlDecode(s), false, "", Conversions.ToString(this.Settings["txtCssBuyButton"]), 1, -1, "50", "", this.TabId, this.UserId, this.UserInfo, "", "", lockStockOnCart, qtyLimit, null);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                NB_Store_CartInfo currentCart;
                if (!this.Page.IsPostBack && (this.Request.QueryString["codeid"] != null))
                {
                    string orderGUID = this.Request.QueryString["codeid"];
                    new CartController().BuildFromSeedOrder(this.PortalId, orderGUID);
                }
                if (this.Page.IsPostBack && this.objGateway.GetBankClick(this.PortalId, this.Request))
                {
                    this.GatewayRedirect();
                }
                this.Stage = "1";
                if (this.Request.QueryString["stg"] != null)
                {
                    this.Stage = this.Request.QueryString["stg"];
                }
                if (Conversions.ToBoolean(this.Settings["chkHideExtraInfo"]))
                {
                    this.plhNoteMsg.Visible = false;
                    this.txtNoteMsg.Visible = false;
                }
                if (Conversions.ToBoolean(this.Settings["chkSkipCart"]))
                {
                    if (this.Stage == "1")
                    {
                        this.Stage = "2";
                    }
                    this.cmdBack1.Visible = false;
                }
                if (Conversions.ToBoolean(this.Settings["chkShowStageHeader"]))
                {
                    this.phHeader.Controls.Add(new LiteralControl(this.Server.HtmlDecode(SharedFunctions.GetStoreSettingText(this.PortalId, "stgheader" + this.Stage + ".template", SharedFunctions.GetCurrentCulture()))));
                }
                if (Conversions.ToBoolean(this.Settings["chkHideShipInCart"]))
                {
                    this.cartlist1.ShippingHidden = true;
                    this.cartlist2.ShippingHidden = true;
                }
                this.pnlAddressDetails.Visible = false;
                this.pnlCart.Visible = false;
                this.pnlLogin.Visible = false;
                this.pnlPayRtn.Visible = false;
                this.pnlPromptPay.Visible = false;
                this.pnlEmptyCart.Visible = false;
                string stage = this.Stage;
                switch (stage)
                {
                    case "2":
                        if (CurrentCart.IsCartEmpty(this.PortalId))
                        {
                            this.DisplayEmptyCart();
                        }
                        else if (!CurrentCart.IsCartAboveMinimum(this.PortalId))
                        {
                            this.DisplayMinimumCart();
                        }
                        else if (this.DisplayLogin())
                        {
                            this.DisplayLoginMsg();
                        }
                        else
                        {
                            this.HideCartOptions();
                            if (!this.Page.IsPostBack)
                            {
                                currentCart = CurrentCart.GetCurrentCart(this.PortalId);
                                this.txtVATCode2.Text = currentCart.VATNumber;
                                this.populateAddress();
                            }
                            this.DisplayExtraDetailMsg();
                        }
                        return;

                    case "3":
                        CurrentCart.ValidateCart(this.PortalId, this.UserInfo);
                        if (CurrentCart.IsCartEmpty(this.PortalId))
                        {
                            this.DisplayEmptyCart();
                        }
                        else
                        {
                            if (!this.Page.IsPostBack)
                            {
                                this.HideCartOptions();
                                this.SetUpOrderList();
                                NB_Store_OrdersInfo order = new NB_Store_OrdersInfo();
                                ArrayList list = new ArrayList();
                                order = new OrderController().GetOrder(CurrentCart.GetCurrentCart(this.PortalId).OrderID);
                                if ((order != null) && (decimal.Compare(order.AlreadyPaid, decimal.Zero) != 0))
                                {
                                    this.cmdCancelOrder.Visible = false;
                                }
                                list.Add(order);
                                this.dlGateway2.DataSource = list;
                                this.dlGateway2.DataBind();
                            }
                            this.AddChqGateway();
                            this.AddBankGateway();
                        }
                        return;

                    case "4":
                        this.objGateway.AutoResponse(this.PortalId, this.Request);
                        if (InternalUpdateInterface.Instance() != null)
                        {
                            InternalUpdateInterface.Instance().AutoResponse(this.PortalId, this.Request);
                        }
                        if (EventInterface.Instance() != null)
                        {
                            EventInterface.Instance().AutoResponse(this.PortalId, this.Request);
                        }
                        if ((this.Session["BankHtmlRedirect"] != null) && Operators.ConditionalCompareObjectNotEqual(this.Session["BankHtmlRedirect"], "", false))
                        {
                            this.Response.Redirect(this.EditUrl("RemotePost"));
                        }
                        return;

                    case "1":
                        if (CurrentCart.IsCartEmpty(this.PortalId))
                        {
                            this.DisplayEmptyCart();
                        }
                        else
                        {
                            this.HideCartOptions();
                            if (!this.Page.IsPostBack)
                            {
                                currentCart = CurrentCart.GetCurrentCart(this.PortalId);
                                this.txtVATCode.Text = currentCart.VATNumber;
                                this.txtPromoCode.Text = currentCart.PromoCode;
                                if (currentCart.CountryCode == "")
                                {
                                    currentCart.CountryCode = SharedFunctions.GetStoreSetting(this.PortalId, "shipcountrycode.default", SharedFunctions.GetCurrentCulture());
                                    if (currentCart.CountryCode == "")
                                    {
                                        currentCart.CountryCode = SharedFunctions.GetMerchantCountryCode(this.PortalId);
                                    }
                                    CurrentCart.Save(currentCart);
                                }
                                SharedFunctions.populateCountryList(this.PortalId, this.ddlCountry, currentCart.CountryCode);
                            }
                            this.SetUpCartList();
                        }
                        return;
                }
                if (stage == "5")
                {
                    if (CurrentCart.IsCartEmpty(this.PortalId))
                    {
                        if (this.Request.QueryString["chq"] == null)
                        {
                            this.objGateway.AutoResponse(this.PortalId, this.Request);
                        }
                        this.DisplayEmptyCart();
                    }
                    else
                    {
                        if (InternalUpdateInterface.Instance() != null)
                        {
                            InternalUpdateInterface.Instance().ReturnToStore(this.PortalId, CurrentCart.GetCurrentCart(this.PortalId), SharedFunctions.GetCurrentCulture(), this.Request);
                        }
                        if (this.Request.QueryString["chq"] != null)
                        {
                            this.CompletedChqPayment();
                        }
                        else
                        {
                            this.CompletedBankPayment();
                        }
                    }
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void PayedByChq()
        {
            this.SaveForm3XML(CurrentCart.GetCurrentCart(this.PortalId).OrderID);
            ChequeInterface.Instance().CompleteOrder(this.PortalId, CurrentCart.GetCurrentCart(this.PortalId).OrderID, SharedFunctions.GetCurrentCulture(), Conversions.ToBoolean(this.Settings["chkStockChq"]));
        }

        private void populateAddress()
        {
            NB_Store_AddressInfo orderAddress;
            OrderController controller = new OrderController();
            NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
            this.pnlAddressDetails.Visible = true;
            this.valEmail.ErrorMessage = DotNetNuke.Services.Localization.Localization.GetString("valEmail", this.LocalResourceFile);
            this.revEmail.ErrorMessage = DotNetNuke.Services.Localization.Localization.GetString("revEmail", this.LocalResourceFile);
            if (Conversions.ToBoolean(this.Settings["chkMinimumValidate"]))
            {
                this.billaddress.NoValidate = true;
                this.shipaddress.NoValidate = true;
            }
            else
            {
                this.billaddress.NoValidate = false;
                this.shipaddress.NoValidate = false;
            }
            if (Conversions.ToBoolean(this.Settings["chkHideShip"]))
            {
                this.radNone.Visible = false;
                this.lblNone.Visible = false;
            }
            if (this.IsNonUserOrder())
            {
                this.chkDefaultAddress.Visible = false;
                this.chkDefaultEmail.Visible = false;
                this.plDefaultAddress.Visible = false;
                this.plDefaultEmail.Visible = false;
            }
            this.pnlShipAddress.Visible = false;
            string shipType = currentCart.ShipType;
            if (shipType == "NONE")
            {
                this.radNone.Checked = true;
            }
            else if (shipType == "BILL")
            {
                this.radBilling.Checked = true;
            }
            else if (shipType == "SHIP")
            {
                this.radShipping.Checked = true;
                this.pnlShipAddress.Visible = true;
            }
            else
            {
                this.radBilling.Checked = true;
                currentCart.ShipType = "BILL";
                CurrentCart.Save(currentCart);
            }
            NB_Store_OrdersInfo order = controller.GetOrder(CurrentCart.GetCurrentCart(this.PortalId).OrderID);
            this.billaddress.AddressDataInfo = new NB_Store_AddressInfo();
            this.shipaddress.AddressDataInfo = new NB_Store_AddressInfo();
            if (order == null)
            {
                if (SharedFunctions.getStoreCookieValue(this.PortalId, CurrentCart.getCartID(this.PortalId), "BAddressName") != "")
                {
                    HttpCookie objCookie = SharedFunctions.getStoreCookie(this.PortalId, CurrentCart.getCartID(this.PortalId));
                    this.txtEmail.Text = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "Email").ToString());
                    this.billaddress.CountryCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BCountryCode").ToString());
                    this.shipaddress.CountryCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SCountryCode").ToString());
                    orderAddress = new NB_Store_AddressInfo {
                        AddressDescription = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BAddressDescription").ToString()),
                        AddressName = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BAddressName").ToString()),
                        AddressName2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BAddressName2").ToString()),
                        Address1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BAddress1").ToString()),
                        Address2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BAddress2").ToString()),
                        City = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BCity").ToString()),
                        CountryCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BCountryCode").ToString()),
                        RegionCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BRegion").ToString()),
                        Phone1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BPhone1").ToString()),
                        Phone2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BPhone2").ToString()),
                        PostalCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BPostalCode").ToString()),
                        CompanyName = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BCompanyName").ToString()),
                        Extra1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BExtra1").ToString()),
                        Extra2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BExtra2").ToString()),
                        Extra3 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BExtra3").ToString()),
                        Extra4 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "BExtra4").ToString())
                    };
                    this.billaddress.AddressDataInfo = orderAddress;
                    orderAddress = new NB_Store_AddressInfo {
                        AddressDescription = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SAddressDescription").ToString()),
                        AddressName = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SAddressName").ToString()),
                        AddressName2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SAddressName2").ToString()),
                        Address1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SAddress1").ToString()),
                        Address2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SAddress2").ToString()),
                        City = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SCity").ToString()),
                        CountryCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SCountryCode").ToString()),
                        RegionCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SRegion").ToString()),
                        Phone1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SPhone1").ToString()),
                        Phone2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SPhone2").ToString()),
                        PostalCode = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SPostalCode").ToString()),
                        CompanyName = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SCompanyName").ToString()),
                        Extra1 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SExtra1").ToString()),
                        Extra2 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SExtra2").ToString()),
                        Extra3 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SExtra3").ToString()),
                        Extra4 = this.Server.UrlDecode(SharedFunctions.getStoreCookieValue(this.PortalId, objCookie, "SExtra4").ToString())
                    };
                    this.shipaddress.AddressDataInfo = orderAddress;
                }
                else
                {
                    this.shipaddress.CountryCode = currentCart.CountryCode;
                    orderAddress = new NB_Store_AddressInfo();
                    if (this.IsNonUserOrder())
                    {
                        orderAddress.AddressName = "";
                        this.txtEmail.Text = "";
                    }
                    else
                    {
                        orderAddress.AddressName = this.UserInfo.FirstName;
                        orderAddress.AddressName2 = this.UserInfo.LastName;
                        this.txtEmail.Text = this.UserInfo.Email;
                    }
                    orderAddress.Address1 = this.UserInfo.Profile.Unit;
                    orderAddress.Address2 = this.UserInfo.Profile.Street;
                    orderAddress.City = this.UserInfo.Profile.City;
                    string countryCodeByName = SharedFunctions.GetCountryCodeByName(this.UserInfo.Profile.Country);
                    if (countryCodeByName == "")
                    {
                        orderAddress.CountryCode = currentCart.CountryCode;
                    }
                    else
                    {
                        orderAddress.CountryCode = countryCodeByName;
                    }
                    orderAddress.RegionCode = this.UserInfo.Profile.Region;
                    orderAddress.Phone1 = this.UserInfo.Profile.Telephone;
                    orderAddress.Phone2 = this.UserInfo.Profile.Cell;
                    orderAddress.PostalCode = this.UserInfo.Profile.PostalCode;
                    if (!Information.IsNothing(this.UserInfo.Profile.GetPropertyValue("CompanyName")))
                    {
                        orderAddress.CompanyName = this.UserInfo.Profile.GetPropertyValue("CompanyName");
                    }
                    this.billaddress.AddressDataInfo = orderAddress;
                }
            }
            else
            {
                if (order.Email != "")
                {
                    this.txtEmail.Text = order.Email;
                }
                else if (this.IsNonUserOrder())
                {
                    this.txtEmail.Text = "";
                }
                else
                {
                    this.txtEmail.Text = this.UserInfo.Email;
                }
                orderAddress = controller.GetOrderAddress(order.BillingAddressID);
                if (orderAddress != null)
                {
                    this.billaddress.AddressDataInfo = orderAddress;
                }
                if (order.ShippingAddressID == -1)
                {
                    this.radNone.Checked = true;
                }
                else if (order.BillingAddressID != order.ShippingAddressID)
                {
                    orderAddress = controller.GetOrderAddress(order.ShippingAddressID);
                    if (orderAddress != null)
                    {
                        this.shipaddress.AddressDataInfo = orderAddress;
                    }
                }
            }
        }

        private void populateShipMethod()
        {
            if (this.rblShipMethod.Visible | this.rblShipMethod2.Visible)
            {
                IEnumerator enumerator=null;
                ShipController controller = new ShipController();
                SettingsController controller2 = new SettingsController();
                string str = "";
                NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
                int shipMethodID = currentCart.ShipMethodID;
                ArrayList shippingMethodEnabledList = controller.GetShippingMethodEnabledList(this.PortalId);
                this.rblShipMethod.Items.Clear();
                this.rblShipMethod2.Items.Clear();
                try
                {
                    enumerator = shippingMethodEnabledList.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        NB_Store_ShippingMethodInfo current = (NB_Store_ShippingMethodInfo) enumerator.Current;
                        decimal shipAmt = CurrentCart.GetCalulatedTotals(this.PortalId, currentCart.VATNumber, currentCart.CountryCode, currentCart.ShipType, current.ShipMethodID).ShipAmt;
                        ListItem item = new ListItem {
                            Value = Conversions.ToString(current.ShipMethodID)
                        };
                        if (current.TemplateName == "NONE")
                        {
                            item.Text = current.MethodDesc;
                        }
                        else
                        {
                            NB_Store_SettingsTextInfo info3 = controller2.GetSettingsText(this.PortalId, current.TemplateName, SharedFunctions.GetCurrentCulture());
                            if (info3 == null)
                            {
                                item.Text = current.MethodDesc;
                            }
                            else
                            {
                                str = Strings.Replace(HttpUtility.HtmlDecode(info3.SettingText), "[TAG:SHIPPINGCOST]", SharedFunctions.FormatToStoreCurrency(this.PortalId, Convert.ToDouble(shipAmt)), 1, -1, CompareMethod.Binary);
                                item.Text = str;
                            }
                        }
                        if (current.ShipMethodID == shipMethodID)
                        {
                            item.Selected = true;
                        }
                        bool flag = false;
                        if (SharedFunctions.IsDealer(this.PortalId, this.UserInfo, SharedFunctions.GetCurrentCulture()) && !current.Dealer)
                        {
                            flag = true;
                        }
                        if (!SharedFunctions.IsDealer(this.PortalId, this.UserInfo, SharedFunctions.GetCurrentCulture()) && !current.NonDealer)
                        {
                            flag = true;
                        }
                        if ((decimal.Compare(shipAmt, decimal.Zero) >= 0) & !flag)
                        {
                            this.rblShipMethod.Items.Add(item);
                            this.rblShipMethod2.Items.Add(item);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                if (this.rblShipMethod.Items.FindByValue(Conversions.ToString(shipMethodID)) == null)
                {
                    if (this.rblShipMethod.Items.Count > 0)
                    {
                        shipMethodID = Conversions.ToInteger(this.rblShipMethod.Items[0].Value);
                        this.rblShipMethod.Items[0].Selected = true;
                        this.rblShipMethod2.Items[0].Selected = true;
                        this.ReDisplayCart();
                    }
                    else
                    {
                        this.DisplaySpecialShippingMsg();
                    }
                }
            }
            else
            {
                NB_Store_CartInfo info4 = CurrentCart.GetCurrentCart(this.PortalId);
                int defaultShipMethod = SharedFunctions.GetDefaultShipMethod(this.PortalId);
                if (decimal.Compare(CurrentCart.GetCalulatedTotals(this.PortalId, info4.VATNumber, info4.CountryCode, info4.ShipType, defaultShipMethod).ShipAmt, decimal.Zero) < 0)
                {
                    this.DisplaySpecialShippingMsg();
                }
            }
        }

        private void radBilling_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radBilling.Checked)
            {
                this.saveAddrCookie();
                CurrentCart.SaveShipType(this.PortalId, "BILL");
                this.populateAddress();
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=2" }));
            }
        }

        private void radNone_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radNone.Checked)
            {
                this.saveAddrCookie();
                CurrentCart.SaveShipType(this.PortalId, "NONE");
                this.populateAddress();
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=2" }));
            }
        }

        private void radShipping_CheckedChanged(object sender, EventArgs e)
        {
            if (this.radShipping.Checked)
            {
                this.saveAddrCookie();
                CurrentCart.SaveShipType(this.PortalId, "SHIP");
                this.populateAddress();
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, "", new string[] { "stg=2" }));
            }
        }

        private void ReDisplayCart()
        {
            int defaultShipMethod = 0;
            NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
            this.cmdOrder.Visible = true;
            if (this.Stage == "1")
            {
                currentCart.VATNumber = this.txtVATCode.Text;
                currentCart.PromoCode = this.txtPromoCode.Text;
                currentCart.CountryCode = this.ddlCountry.SelectedValue;
                if (this.rblShipMethod.SelectedIndex >= 0)
                {
                    defaultShipMethod = Conversions.ToInteger(this.rblShipMethod.SelectedValue);
                }
                else
                {
                    defaultShipMethod = SharedFunctions.GetDefaultShipMethod(this.PortalId);
                }
            }
            if (this.Stage == "3")
            {
                if (this.rblShipMethod2.SelectedIndex >= 0)
                {
                    defaultShipMethod = Conversions.ToInteger(this.rblShipMethod2.SelectedValue);
                }
                else
                {
                    defaultShipMethod = SharedFunctions.GetDefaultShipMethod(this.PortalId);
                }
            }
            currentCart.ShipMethodID = defaultShipMethod;
            CurrentCart.Save(currentCart);
            if (this.Stage == "1")
            {
                this.SetUpCartList();
                this.cartlist1.PopulateCartList();
            }
            if (this.Stage == "3")
            {
                this.SetUpOrderList();
                this.cartlist2.PopulateCartList();
            }
            this.populateShipMethod();
        }

        private void removeAddrCookie()
        {
            HttpCookie cookie = new HttpCookie("NB_Store2_" + CurrentCart.getCartID(this.PortalId) + "_Portal" + this.PortalId.ToString());
            cookie["Email"] = "";
            cookie["BAddressDescription"] = "";
            cookie["BAddressName"] = "";
            cookie["BAddressName2"] = "";
            cookie["BAddress1"] = "";
            cookie["BAddress2"] = "";
            cookie["BCity"] = "";
            cookie["BCountryCode"] = "";
            cookie["BRegion"] = "";
            cookie["BPhone1"] = "";
            cookie["BPhone2"] = "";
            cookie["BPostalCode"] = "";
            cookie["BCompanyName"] = "";
            cookie["BExtra1"] = "";
            cookie["BExtra2"] = "";
            cookie["BExtra3"] = "";
            cookie["BExtra4"] = "";
            cookie["SAddressDescription"] = "";
            cookie["SAddressName"] = "";
            cookie["SAddressName2"] = "";
            cookie["SAddress1"] = "";
            cookie["SAddress2"] = "";
            cookie["SCity"] = "";
            cookie["SCountryCode"] = "";
            cookie["SRegion"] = "";
            cookie["SPhone1"] = "";
            cookie["SPhone2"] = "";
            cookie["SPostalCode"] = "";
            cookie["SCompanyName"] = "";
            cookie["SExtra1"] = "";
            cookie["SExtra2"] = "";
            cookie["SExtra3"] = "";
            cookie["SExtra4"] = "";
            cookie.Expires = DateAndTime.DateAdd(DateInterval.Day, 30.0, DateAndTime.Today);
            HttpContext.Current.Response.Cookies.Add(cookie);
        }

        private void saveAddrCookie()
        {
            HttpCookie cookie = new HttpCookie("NB_Store2_" + CurrentCart.getCartID(this.PortalId) + "_Portal" + this.PortalId.ToString());
            NB_Store_AddressInfo addressDataInfo = this.billaddress.AddressDataInfo;
            cookie["Email"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(this.txtEmail.Text));
            cookie["BAddressDescription"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressDescription));
            cookie["BAddressName"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressName));
            cookie["BAddressName2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressName2));
            cookie["BAddress1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Address1));
            cookie["BAddress2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Address2));
            cookie["BCity"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.City));
            cookie["BCountryCode"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.CountryCode));
            cookie["BRegion"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.RegionCode));
            cookie["BPhone1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Phone1));
            cookie["BPhone2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Phone2));
            cookie["BPostalCode"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.PostalCode));
            cookie["BCompanyName"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.CompanyName));
            cookie["BExtra1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra1));
            cookie["BExtra2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra2));
            cookie["BExtra3"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra3));
            cookie["BExtra4"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra4));
            addressDataInfo = this.shipaddress.AddressDataInfo;
            cookie["SAddressDescription"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressDescription));
            cookie["SAddressName"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressName));
            cookie["SAddressName2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.AddressName2));
            cookie["SAddress1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Address1));
            cookie["SAddress2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Address2));
            cookie["SCity"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.City));
            cookie["SCountryCode"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.CountryCode));
            cookie["SRegion"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.RegionCode));
            cookie["SPhone1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Phone1));
            cookie["SPhone2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Phone2));
            cookie["SPostalCode"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.PostalCode));
            cookie["SCompanyName"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.CompanyName));
            cookie["SExtra1"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra1));
            cookie["SExtra2"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra2));
            cookie["SExtra3"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra3));
            cookie["SExtra4"] = SharedFunctions.StoreEncrypt(this.PortalId, this.Server.UrlEncode(addressDataInfo.Extra4));
            cookie.Expires = DateAndTime.DateAdd(DateInterval.Day, 30.0, DateAndTime.Today);
            HttpContext.Current.Response.Cookies.Add(cookie);
        }

        private int SaveAddress(Address AddCtrl, int OrderID)
        {
            OrderController controller = new OrderController();
            NB_Store_AddressInfo objInfo = new NB_Store_AddressInfo();
            objInfo = AddCtrl.AddressDataInfo;
            objInfo.PortalID = this.PortalId;
            objInfo.CreatedByUser = Conversions.ToString(this.UserId);
            objInfo.CreatedDate = DateAndTime.Now;
            objInfo.OrderID = OrderID;
            objInfo.PrimaryAddress = false;
            objInfo.AddressID = -1;
            objInfo.UserID = this.UserId;
            return controller.UpdateObjOrderAddress(objInfo).AddressID;
        }

        private void SaveForm3XML(int OrderID)
        {
            OrderController controller = new OrderController();
            NB_Store_OrdersInfo order = controller.GetOrder(CurrentCart.GetCurrentCart(this.PortalId).OrderID);
            if (order != null)
            {
                order.Stg3FormXML = this.Stg3Form.XMLData;
                controller.UpdateObjOrder(order);
            }
        }

        private void SaveOrder()
        {
            int num2=0;
            OrderController controller = new OrderController();
            NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
            if (this.radNone.Checked)
            {
                currentCart.ShipType = "NONE";
                currentCart.CountryCode = this.billaddress.AddressDataInfo.CountryCode;
            }
            if (this.radBilling.Checked)
            {
                currentCart.ShipType = "BILL";
                currentCart.CountryCode = this.billaddress.AddressDataInfo.CountryCode;
            }
            if (this.radShipping.Checked)
            {
                currentCart.ShipType = "SHIP";
                currentCart.CountryCode = this.shipaddress.AddressDataInfo.CountryCode;
            }
            currentCart.VATNumber = this.txtVATCode2.Text;
            CurrentCart.Save(currentCart);
            string orderEmail = this.UpdateOrderEmail(this.txtEmail.Text, this.billaddress);
            NB_Store_OrdersInfo objInfo = CurrentCart.CreateOrder(this.UserId, this.PortalId, this.txtNoteMsg.Text, orderEmail, this.UserInfo);
            objInfo.Stg2FormXML = this.Stg2Form.XMLData;
            int num = this.SaveAddress(this.billaddress, objInfo.OrderID);
            if (this.radNone.Checked)
            {
                num2 = -1;
            }
            if (this.radBilling.Checked)
            {
                num2 = num;
            }
            if (this.radShipping.Checked)
            {
                num2 = this.SaveAddress(this.shipaddress, objInfo.OrderID);
            }
            objInfo.BillingAddressID = num;
            objInfo.ShippingAddressID = num2;
            controller.UpdateObjOrder(objInfo);
        }

        private void SetUpCartList()
        {
            TaxCalcController controller = new TaxCalcController(this.PortalId);
            NB_Store_CartInfo currentCart = CurrentCart.GetCurrentCart(this.PortalId);
            int shipMethodID = currentCart.ShipMethodID;
            currentCart.ShipType = "";
            CurrentCart.Save(currentCart);
            if (shipMethodID <= 0)
            {
                shipMethodID = SharedFunctions.GetDefaultShipMethod(this.PortalId);
            }
            this.pnlCart.Visible = true;
            if (!this.Page.IsPostBack)
            {
                this.populateShipMethod();
            }
            this.cartlist1.CartID = currentCart.CartID;
            this.cartlist1.PortalID = Conversions.ToString(this.PortalId);
            this.cartlist1.ShipMethodID = Conversions.ToString(shipMethodID);
            this.cartlist1.TaxOption = controller.getTaxOption();
            this.cartlist1.ResourceFile = this.LocalResourceFile;
            this.cartlist1.ShowDiscountCol = Conversions.ToBoolean(this.Settings["chkShowDiscountCol"]);
            this.cartlist1.NoUpdates = false;
        }

        private void SetUpOrderList()
        {
            TaxCalcController controller = new TaxCalcController(this.PortalId);
            this.pnlPromptPay.Visible = true;
            this.populateShipMethod();
            this.cartlist2.CartID = CurrentCart.GetCurrentCart(this.PortalId).CartID;
            this.cartlist2.PortalID = Conversions.ToString(this.PortalId);
            this.cartlist2.TaxOption = controller.getTaxOption();
            this.cartlist2.ResourceFile = this.LocalResourceFile;
            this.cartlist2.ShowDiscountCol = Conversions.ToBoolean(this.Settings["chkShowDiscountCol"]);
            this.cartlist2.NoUpdates = true;
            this.cartlist2.ShipMethodID = Conversions.ToString(CurrentCart.GetCurrentCart(this.PortalId).ShipMethodID);
            SharedFunctions.DisplayMsgText(Conversions.ToString(this.PortalId), this.plhGatewayMsg, "gatewaymsg.text", "");
        }

        private string UpdateOrderEmail(string OrderEmail, Address AddCtrl)
        {
            string str = "";
            if (this.IsNonUserOrder())
            {
                return OrderEmail;
            }
            bool flag = false;
            if (this.UserInfo.Email != OrderEmail)
            {
                str = OrderEmail;
                if (this.chkDefaultEmail.Checked)
                {
                    this.UserInfo.Email = OrderEmail;
                    this.UserInfo.Membership.Email = OrderEmail;
                    str = "";
                    flag = true;
                }
            }
            if (this.chkDefaultAddress.Checked)
            {
                NB_Store_AddressInfo addressDataInfo = new NB_Store_AddressInfo();
                addressDataInfo = AddCtrl.AddressDataInfo;
                this.UserInfo.Profile.Unit = addressDataInfo.Address1;
                this.UserInfo.Profile.Street = addressDataInfo.Address2;
                this.UserInfo.Profile.Region = addressDataInfo.RegionCode;
                this.UserInfo.Profile.PostalCode = addressDataInfo.PostalCode;
                this.UserInfo.Profile.City = addressDataInfo.City;
                this.UserInfo.Profile.Telephone = addressDataInfo.Phone1;
                this.UserInfo.Profile.Cell = addressDataInfo.Phone2;
                if (!Information.IsNothing(this.UserInfo.Profile.GetPropertyValue("CompanyName")))
                {
                    this.UserInfo.Profile.SetProfileProperty("CompanyName", addressDataInfo.CompanyName);
                }
                flag = true;
            }
            if (flag)
            {
                UserController.UpdateUser(this.PortalId, this.UserInfo);
            }
            return str;
        }

        protected virtual Address billaddress
        {
            get
            {
                return this._billaddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._billaddress = value;
            }
        }

        protected virtual CartList cartlist1
        {
            get
            {
                return this._cartlist1;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                CartList.ValidateCartEventHandler handler = new CartList.ValidateCartEventHandler(this.cartlist1_ValidateCart);
                CartList.RecalculateCartEventHandler handler2 = new CartList.RecalculateCartEventHandler(this.cartlist1_RecalculateCart);
                CartList.CartIsEmptyEventHandler handler3 = new CartList.CartIsEmptyEventHandler(this.cartlist1_CartIsEmpty);
                if (this._cartlist1 != null)
                {
                    this._cartlist1.ValidateCart -= handler;
                    this._cartlist1.RecalculateCart -= handler2;
                    this._cartlist1.CartIsEmpty -= handler3;
                }
                this._cartlist1 = value;
                if (this._cartlist1 != null)
                {
                    this._cartlist1.ValidateCart += handler;
                    this._cartlist1.RecalculateCart += handler2;
                    this._cartlist1.CartIsEmpty += handler3;
                }
            }
        }

        protected virtual CartList cartlist2
        {
            get
            {
                return this._cartlist2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._cartlist2 = value;
            }
        }

        protected virtual LinkButton cmdBack1
        {
            get
            {
                return this._cmdBack1;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdBack1_Click);
                if (this._cmdBack1 != null)
                {
                    this._cmdBack1.Click -= handler;
                }
                this._cmdBack1 = value;
                if (this._cmdBack1 != null)
                {
                    this._cmdBack1.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdBack2
        {
            get
            {
                return this._cmdBack2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdBack2_Click);
                if (this._cmdBack2 != null)
                {
                    this._cmdBack2.Click -= handler;
                }
                this._cmdBack2 = value;
                if (this._cmdBack2 != null)
                {
                    this._cmdBack2.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdCancelOrder
        {
            get
            {
                return this._cmdCancelOrder;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdCancelOrder_Click);
                if (this._cmdCancelOrder != null)
                {
                    this._cmdCancelOrder.Click -= handler;
                }
                this._cmdCancelOrder = value;
                if (this._cmdCancelOrder != null)
                {
                    this._cmdCancelOrder.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdContShop
        {
            get
            {
                return this._cmdContShop;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdContShop_Click);
                if (this._cmdContShop != null)
                {
                    this._cmdContShop.Click -= handler;
                }
                this._cmdContShop = value;
                if (this._cmdContShop != null)
                {
                    this._cmdContShop.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdNext1
        {
            get
            {
                return this._cmdNext1;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdNext1_Click);
                if (this._cmdNext1 != null)
                {
                    this._cmdNext1.Click -= handler;
                }
                this._cmdNext1 = value;
                if (this._cmdNext1 != null)
                {
                    this._cmdNext1.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdOrder
        {
            get
            {
                return this._cmdOrder;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdOrder_Click);
                if (this._cmdOrder != null)
                {
                    this._cmdOrder.Click -= handler;
                }
                this._cmdOrder = value;
                if (this._cmdOrder != null)
                {
                    this._cmdOrder.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdPromo
        {
            get
            {
                return this._cmdPromo;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this._Lambda__1);
                if (this._cmdPromo != null)
                {
                    this._cmdPromo.Click -= handler;
                }
                this._cmdPromo = value;
                if (this._cmdPromo != null)
                {
                    this._cmdPromo.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdVAT
        {
            get
            {
                return this._cmdVAT;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this._Lambda__2);
                if (this._cmdVAT != null)
                {
                    this._cmdVAT.Click -= handler;
                }
                this._cmdVAT = value;
                if (this._cmdVAT != null)
                {
                    this._cmdVAT.Click += handler;
                }
            }
        }

        protected virtual CheckBox chkDefaultAddress
        {
            get
            {
                return this._chkDefaultAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._chkDefaultAddress = value;
            }
        }

        protected virtual CheckBox chkDefaultEmail
        {
            get
            {
                return this._chkDefaultEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._chkDefaultEmail = value;
            }
        }

        protected virtual CheckBox chkSaveAddrCookie
        {
            get
            {
                return this._chkSaveAddrCookie;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._chkSaveAddrCookie = value;
            }
        }

        protected virtual DropDownList ddlCountry
        {
            get
            {
                return this._ddlCountry;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.ddlCountry_SelectedIndexChanged);
                if (this._ddlCountry != null)
                {
                    this._ddlCountry.SelectedIndexChanged -= handler;
                }
                this._ddlCountry = value;
                if (this._ddlCountry != null)
                {
                    this._ddlCountry.SelectedIndexChanged += handler;
                }
            }
        }

        protected virtual HtmlGenericControl divPromoCode
        {
            get
            {
                return this._divPromoCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divPromoCode = value;
            }
        }

        protected virtual HtmlGenericControl divShipCountry
        {
            get
            {
                return this._divShipCountry;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divShipCountry = value;
            }
        }

        protected virtual HtmlGenericControl divShipMethod
        {
            get
            {
                return this._divShipMethod;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divShipMethod = value;
            }
        }

        protected virtual HtmlGenericControl divShipMethod2
        {
            get
            {
                return this._divShipMethod2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divShipMethod2 = value;
            }
        }

        protected virtual HtmlGenericControl divVATCode
        {
            get
            {
                return this._divVATCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divVATCode = value;
            }
        }

        protected virtual HtmlGenericControl divVATCode2
        {
            get
            {
                return this._divVATCode2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._divVATCode2 = value;
            }
        }

        protected virtual DataList dlGateway2
        {
            get
            {
                return this._dlGateway2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                DataListCommandEventHandler handler = new DataListCommandEventHandler(this.dlGateway2_ItemCommand);
                if (this._dlGateway2 != null)
                {
                    this._dlGateway2.ItemCommand -= handler;
                }
                this._dlGateway2 = value;
                if (this._dlGateway2 != null)
                {
                    this._dlGateway2.ItemCommand += handler;
                }
            }
        }

        protected virtual ImageButton imgBChq
        {
            get
            {
                return this._imgBChq;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                ImageClickEventHandler handler = new ImageClickEventHandler(this.imgBChq_Click);
                if (this._imgBChq != null)
                {
                    this._imgBChq.Click -= handler;
                }
                this._imgBChq = value;
                if (this._imgBChq != null)
                {
                    this._imgBChq.Click += handler;
                }
            }
        }

        protected virtual Label lblBankCard
        {
            get
            {
                return this._lblBankCard;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblBankCard = value;
            }
        }

        protected virtual Label lblBillingAddressTitle
        {
            get
            {
                return this._lblBillingAddressTitle;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblBillingAddressTitle = value;
            }
        }

        protected virtual Label lblCheque
        {
            get
            {
                return this._lblCheque;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblCheque = value;
            }
        }

        protected virtual Label lblNone
        {
            get
            {
                return this._lblNone;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblNone = value;
            }
        }

        protected virtual Label lblShippingAddressTitle
        {
            get
            {
                return this._lblShippingAddressTitle;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblShippingAddressTitle = value;
            }
        }

        protected virtual Label lblUseBillingAddress
        {
            get
            {
                return this._lblUseBillingAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblUseBillingAddress = value;
            }
        }

        protected virtual Label lblUseShippingAddress
        {
            get
            {
                return this._lblUseShippingAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblUseShippingAddress = value;
            }
        }

        protected virtual Label plDefaultAddress
        {
            get
            {
                return this._plDefaultAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plDefaultAddress = value;
            }
        }

        protected virtual Label plDefaultEmail
        {
            get
            {
                return this._plDefaultEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plDefaultEmail = value;
            }
        }

        protected virtual Label plEmail
        {
            get
            {
                return this._plEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plEmail = value;
            }
        }

        protected virtual PlaceHolder plhGateway
        {
            get
            {
                return this._plhGateway;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plhGateway = value;
            }
        }

        protected virtual PlaceHolder plhGatewayMsg
        {
            get
            {
                return this._plhGatewayMsg;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plhGatewayMsg = value;
            }
        }

        protected virtual PlaceHolder plhNoteMsg
        {
            get
            {
                return this._plhNoteMsg;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plhNoteMsg = value;
            }
        }

        protected virtual PlaceHolder plhPayRtn
        {
            get
            {
                return this._plhPayRtn;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plhPayRtn = value;
            }
        }

        protected virtual Label plPromoCode
        {
            get
            {
                return this._plPromoCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plPromoCode = value;
            }
        }

        protected virtual Label plSaveAddrCookie
        {
            get
            {
                return this._plSaveAddrCookie;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plSaveAddrCookie = value;
            }
        }

        protected virtual Label plShipCountry1
        {
            get
            {
                return this._plShipCountry1;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plShipCountry1 = value;
            }
        }

        protected virtual Label plShippingMethods
        {
            get
            {
                return this._plShippingMethods;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plShippingMethods = value;
            }
        }

        protected virtual Label plVATCode
        {
            get
            {
                return this._plVATCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plVATCode = value;
            }
        }

        protected virtual Label plVATCode2
        {
            get
            {
                return this._plVATCode2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plVATCode2 = value;
            }
        }

        protected virtual Panel pnlAddress
        {
            get
            {
                return this._pnlAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlAddress = value;
            }
        }

        protected virtual Panel pnlAddressDetails
        {
            get
            {
                return this._pnlAddressDetails;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlAddressDetails = value;
            }
        }

        protected virtual Panel pnlCart
        {
            get
            {
                return this._pnlCart;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlCart = value;
            }
        }

        protected virtual Panel pnlEmptyCart
        {
            get
            {
                return this._pnlEmptyCart;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlEmptyCart = value;
            }
        }

        protected virtual Panel pnlGateway1
        {
            get
            {
                return this._pnlGateway1;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlGateway1 = value;
            }
        }

        protected virtual Panel pnlGateway2
        {
            get
            {
                return this._pnlGateway2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlGateway2 = value;
            }
        }

        protected virtual Panel pnlLogin
        {
            get
            {
                return this._pnlLogin;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlLogin = value;
            }
        }

        protected virtual Panel pnlPayRtn
        {
            get
            {
                return this._pnlPayRtn;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlPayRtn = value;
            }
        }

        protected virtual Panel pnlPromptPay
        {
            get
            {
                return this._pnlPromptPay;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlPromptPay = value;
            }
        }

        protected virtual Panel pnlShipAddress
        {
            get
            {
                return this._pnlShipAddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlShipAddress = value;
            }
        }

        protected virtual PlaceHolder phEmptyCart
        {
            get
            {
                return this._phEmptyCart;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._phEmptyCart = value;
            }
        }

        protected virtual PlaceHolder phHeader
        {
            get
            {
                return this._phHeader;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._phHeader = value;
            }
        }

        protected virtual PlaceHolder phLogin
        {
            get
            {
                return this._phLogin;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._phLogin = value;
            }
        }

        protected virtual RadioButton radBilling
        {
            get
            {
                return this._radBilling;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.radBilling_CheckedChanged);
                if (this._radBilling != null)
                {
                    this._radBilling.CheckedChanged -= handler;
                }
                this._radBilling = value;
                if (this._radBilling != null)
                {
                    this._radBilling.CheckedChanged += handler;
                }
            }
        }

        protected virtual RadioButton radNone
        {
            get
            {
                return this._radNone;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.radNone_CheckedChanged);
                if (this._radNone != null)
                {
                    this._radNone.CheckedChanged -= handler;
                }
                this._radNone = value;
                if (this._radNone != null)
                {
                    this._radNone.CheckedChanged += handler;
                }
            }
        }

        protected virtual RadioButton radShipping
        {
            get
            {
                return this._radShipping;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.radShipping_CheckedChanged);
                if (this._radShipping != null)
                {
                    this._radShipping.CheckedChanged -= handler;
                }
                this._radShipping = value;
                if (this._radShipping != null)
                {
                    this._radShipping.CheckedChanged += handler;
                }
            }
        }

        protected virtual RadioButtonList rblShipMethod
        {
            get
            {
                return this._rblShipMethod;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.ddlCountry_SelectedIndexChanged);
                if (this._rblShipMethod != null)
                {
                    this._rblShipMethod.SelectedIndexChanged -= handler;
                }
                this._rblShipMethod = value;
                if (this._rblShipMethod != null)
                {
                    this._rblShipMethod.SelectedIndexChanged += handler;
                }
            }
        }

        protected virtual RadioButtonList rblShipMethod2
        {
            get
            {
                return this._rblShipMethod2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.ddlCountry_SelectedIndexChanged);
                if (this._rblShipMethod2 != null)
                {
                    this._rblShipMethod2.SelectedIndexChanged -= handler;
                }
                this._rblShipMethod2 = value;
                if (this._rblShipMethod2 != null)
                {
                    this._rblShipMethod2.SelectedIndexChanged += handler;
                }
            }
        }

        protected virtual RegularExpressionValidator revEmail
        {
            get
            {
                return this._revEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._revEmail = value;
            }
        }

        protected virtual Address shipaddress
        {
            get
            {
                return this._shipaddress;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._shipaddress = value;
            }
        }

        protected virtual CustomForm Stg2Form
        {
            get
            {
                return this._Stg2Form;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._Stg2Form = value;
            }
        }

        protected virtual CustomForm Stg3Form
        {
            get
            {
                return this._Stg3Form;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._Stg3Form = value;
            }
        }

        protected virtual TextBox txtEmail
        {
            get
            {
                return this._txtEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtEmail = value;
            }
        }

        protected virtual TextBox txtNoteMsg
        {
            get
            {
                return this._txtNoteMsg;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtNoteMsg = value;
            }
        }

        protected virtual TextBox txtPromoCode
        {
            get
            {
                return this._txtPromoCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtPromoCode = value;
            }
        }

        protected virtual TextBox txtVATCode
        {
            get
            {
                return this._txtVATCode;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtVATCode = value;
            }
        }

        protected virtual TextBox txtVATCode2
        {
            get
            {
                return this._txtVATCode2;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtVATCode2 = value;
            }
        }

        protected virtual RequiredFieldValidator valEmail
        {
            get
            {
                return this._valEmail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._valEmail = value;
            }
        }
    }
}

